package fr.n7.khome.dao;

import java.util.Collection;

import fr.n7.khome.core.Fuzzy;
import fr.n7.khome.model.Lodging;
import fr.n7.khome.model.LodgingType;
import fr.n7.khome.util.FuzzyFormatException;
import fr.n7.khome.util.InvalidFuzzyValueException;

public class TestDAO {

	/**
	 * @param args
	 * @throws FuzzyFormatException 
	 * @throws InvalidFuzzyValueException 
	 */
	public static void main(String[] args) throws FuzzyFormatException, InvalidFuzzyValueException {
		// TODO Auto-generated method stub
		LodgingDAO ldao = new LodgingDAODatabase();
		//LodgingDAO ldao = new LodgingDAOMap();
		Lodging l = new Lodging();
		l.setPrice(Fuzzy.parse("10."));
		l.setType(LodgingType.FLAT);
		l.setLiveSurface(Fuzzy.parse("10"));
		l.setFieldSurface(Fuzzy.parse("10"));
		l.setAge(Fuzzy.parse("10"));
		l.setWorkPricePC(Fuzzy.parse("10"));
		System.out.println(l);
		ldao.create(l);
		Collection<Lodging> list = ldao.listAll();
		System.out.println("Dans la bd, nous avons : ");
		for(Lodging lo : list) {
			System.out.println(lo);
		}
	}

}
